package org.example.SystemDemo.comment.enity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.example.SystemDemo.comment.req.ConnectREQ;

import java.io.Serializable;
import java.util.Date;

@Data
@TableName("hostinfo")
@EqualsAndHashCode(callSuper = false)
@AllArgsConstructor
@NoArgsConstructor
public class HostInfo implements Serializable {

    private static final long serialVersionUID = 1L;


    public HostInfo(ConnectREQ req, long index, String hostName){
        this.id = index;
        this.hostName = hostName;
        this.hostIp = req.getHostIp();
        this.password = req.getHostPass();
        this.username = req.getHostName();
        this.sshPort = req.getHostPort();
        this.runPort = req.getRunPort();
        this.connectStatus = false;
    }

    /**
     * id主键
     */
    @TableId(type = IdType.AUTO)
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long id;

    /**
     * 主机名
     */
    private String hostName;

    /**
     * 主机地址
     */
    private String hostIp;

    /**
     * 用户名
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * ssh端口号
     */
    private String sshPort;

    /**
     * 连接状态
     */
    private boolean connectStatus;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;

    /**
     * 运行端口号
     */
    private String runPort;
}
